<?php
	class kieudangdb
	{
		public function Add($KieuDang)
		{
			$sql = "INSERT INTO `tbl_kieudang`(`KieuDang`) VALUES (".dataservice::slashes($KieuDang).")";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function Delete($MaKieuDang)
		{
			$sql = "DELETE FROM `tbl_kieudang` WHERE MaKieuDang = $MaKieuDang";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function Update($MaKieuDang, $KieuDang)
		{
			$sql = "UPDATE `tbl_kieudang` SET KieuDang = ".dataservice::slashes($KieuDang)." WHERE MaKieuDang = '$MaKieuDang'"; 
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
	
		public function GetList($MaKieuDang, $KieuDang)
		{
			$sql = "SELECT * FROM `tbl_kieudang` WHERE 1";
			if($MaKieuDang!="")
				$sql .= " AND MaKieuDang = $MaKieuDang ";
			if($KieuDang!="")
				$sql .= " AND KieuDang LIKE '%$KieuDang%' ";
			$data = new dataservice();
			return $data->ExecuteQuery($sql);
		}
		public function Find($KieuDang)
		{
			$sql = "SELECT * FROM `tbl_kieudang` WHERE 1";
			if($KieuDang!="")
				$sql = " SELECT * FROM `tbl_kieudang` WHERE KieuDang LIKE '%$KieuDang%' ";
			$data = new dataservice();
			return $data->ExecuteQuery($sql);
		}
		
	}
?>